package com.miku.project.service;





import com.baomidou.mybatisplus.extension.service.IService;
import com.miku.mikuapicommon.model.entity.User;
import com.miku.project.model.dto.user.UserEmailBindRequest;
import com.miku.project.model.dto.user.UserEmailLoginRequest;
import com.miku.project.model.dto.user.UserEmailRegisterRequest;
import com.miku.project.model.dto.user.UserRegisterRequest;
import com.miku.project.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 用户服务
 *
 * @author <a href="https://gitee.com/deng-taotao-eee">miku</a>
 * @from <a href=""></a>
 */
public interface UserService extends IService<User> {

    /**
     * 用户注册
     *
     * @return 新用户 id
     */
    long userRegister(UserRegisterRequest userRegisterRequest);

    /**
     * 用户登录
     *
     * @param userAccount  用户账户
     * @param userPassword 用户密码
     * @param request
     * @return 脱敏后的用户信息
     */
    UserVO userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    UserVO getLoginUser(HttpServletRequest request);

    /**
     * 是否为管理员
     *
     * @param request
     * @return
     */
    boolean isAdmin(HttpServletRequest request);

    /**
     * 是游客
     * @param request
     * @return
     */
    User isTourist(HttpServletRequest request);

    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 使用邮箱注册
     * @param userEmailRegisterRequest
     * @return
     */
    long userEmilRegister(UserEmailRegisterRequest userEmailRegisterRequest);

    /**
     * 使用邮箱登录
     * @param userEmailLoginRequest
     * @param request
     * @return
     */
    UserVO userEmailLogin(UserEmailLoginRequest userEmailLoginRequest, HttpServletRequest request);

    /**
     * 绑定邮箱
     * @param userEmailBindRequest
     * @param request
     * @return
     */
    UserVO userBindEmail(UserEmailBindRequest userEmailBindRequest, HttpServletRequest request);

    /**
     * 解绑邮箱
     * @param userEmailBindRequest
     * @param request
     * @return
     */
    UserVO userUnBindEmail(UserEmailBindRequest userEmailBindRequest, HttpServletRequest request);

    /**
     * 校验
     * @param user
     * @param b
     */
    void validUser(User user, boolean b);

    /**
     * 更新凭证
     * @param user
     * @return
     */
    UserVO updateVoucher(User user);

    /**
     * 添加钱包余额
     * @param userId
     * @param addPoints
     * @return
     */
    boolean addWalletBalance(Long userId,Integer addPoints);

    /**
     * 减少钱包余额
     * @param userId
     * @param reducePoints
     * @return
     */
    boolean reduceWalletBalance(Long userId,Integer reducePoints);
}
